#include "LoginCommand.h"
#include "AppFacade.h"

#include "LoginVO.h"
#include "loginProxy.h"
#include "loginMediator.h"

#include "ConstString.h"

/**
 * @brief LoginCommand构造函数
 * 初始化父类SimpleCommand
 */
LoginCommand::LoginCommand()
      :SimpleCommand()
{
}

/**
 * @brief LoginCommand析构函数
 */
LoginCommand::~LoginCommand(void)
{
}

/**
 * @brief 执行登录命令
 * 从通知中获取登录数据，调用LoginProxy处理登录请求
 * @param notification 包含LoginVO数据的通知对象
 */
void LoginCommand::execute(INotification const& notification)
{
    data::LoginVO * loginData = (data::LoginVO *)notification.getBody();

    if (NULL != loginData)
    {
        IFacade &facade = AppFacade::getInstance();

        LoginProxy* proxy = dynamic_cast<LoginProxy*>(&AppFacade::getInstance().retrieveProxy(LOGIN_PROXY_NAME));
        proxy->RequsetToLogin(* loginData);
    }

}